1. Field of the Invention
The invention relates to a method of generating a two dimensional image of a surface in a higher dimensional model space, the method comprising the steps of
selecting a viewpoint relative to the surface; PA1 determining an area in the image in which the surface is visible as viewed from the viewpoint; PA1 texture mapping a texture on said area, according to a coordinate map. PA1 texture mapping at least a further texture on said area according to a further coordinate map, a relative offset between the coordinate map and the further coordinate map being adjusted in dependence on the viewpoint; PA1 rendering a combination of said mapped texture and said further mapped texture in said area. Thus, at least two textures maps are used for the same surface, each involving its own texture assigning a visual property as a function of texture coordinates pair (u,v). Each texture map also defines its own coordinate map, which maps coordinate pairs (x,y) of pixels in the area where the surface is visible to texture coordinate pairs (u,v). The coordinate maps defined by the different texture maps each depend in a different way on the direction from which the surface is viewed, so as to simulate the effect of different spacings between the surface and notional surfaces carrying the corresponding textures. For a pixel which belongs to the area in which the surface is visible, a respective visual property is determined by conventional texture mapping for each of the texture maps used for the surface. The pixel is rendered in the image according to a combination of these visual properties. The required calculations are largely the same as those needed for conventional texture mapping. Thus, it is possible to render parallax changes of a texture better than conventional texture mapping without more complex calculations.
The invention also relates to a computer graphics device comprising a mapping unit, for mapping a modeled surface from a three or higher dimensional space on an area of pixels in a two dimensional image and a texture mapping unit for mapping a texture on the pixels of said area, according to a coordinate map.
2. Description of the Related Art
Such a method is known for example from GB patent application no GB 2,288,304.
In computer graphics a two dimensional visual image is generated of mathematically modeled surfaces in a higher dimensional space, as viewed from a selectable viewpoint in that higher dimensional space. To enhance the realism of the image, texture mapping is applied to the surfaces. The model of a surface specifies a texture and a correspondence between surface locations and texture coordinates (u,v). From this correspondence follows a coordinate map which maps pixel coordinates (x,y) of pixels in an area in the image where the surface is visible, to texture coordinates (u,v). A pixel in such an area with pixel coordinate pair (x,y) is rendered in the image according to the visual property assigned by the texture to the texture coordinate pair (u,v) to which that pixel coordinate pair (x,y) maps.
Texture mapping provides good results for representing optical texture such as coloring. Texture mapping works less well for representing geometrical texture, such as the texture associated with unevenness of the surface (bumpiness), because the appearance of such a texture depends on the direction from which it is viewed, and not merely on the position of pixels on the surface. This means that texture mapping lacks realism when images, of the same surfaces from different viewpoints, have to be computed of surfaces that look differently from different angles, for example for simulating movement through the higher dimensional space or for simulating stereoscopic image pairs.
In order to enhance the realism of the images in such circumstances, a method of texture mapping must be provided which makes it possible to change the appearance of the mapped texture as a function of the direction from which the surface is viewed.
It has been known to achieve this by supplementing the texture by a surface normal perturbation function, as a function of the texture coordinates. In the calculation of the image contribution of a pixel with a certain pixel coordinate pair (x,y) in an area in which the surface is visible, a perturbed normal is calculated by perturbing the normal of the surface according to the perturbation function value for the texture coordinate pair (u,v), to which the pixel coordinate pair (x,y) maps. The parameters of the light reaching the viewpoint via the surface are subsequently computed according to the perturbed surface normal. This makes it possible to represent lighting changes due to unevenness of the surface, but it does not make it possible to represent parallax changes. Moreover, the calculation of perturbed surface normals is a resource intensive operation.